package edu.hawaii.stack.configuration;

import static org.junit.Assert.assertEquals;
import java.io.File;
import org.junit.Test;
import edu.hawaii.stack.Stack;
/**
 * A simple test of the ConfigurationManager to see that it can read in the example stack. 
 * @author Philip
 */
public class TestConfigurationManager {

  /**
   * Read in stack.example.xml and see that it was processed correctly. 
   * @throws Exception If problems occur. 
   */
  @Test
  public void testConfigurationManager() throws Exception {
    File exampleStackXml = new File(System.getProperty("user.dir") + "/xml/stack.example.xml");
    File exampleStackXsd = new File(System.getProperty("user.dir") + "/xml/stack.definition.xsd");
    ConfigurationManager manager = new ConfigurationManager(exampleStackXml, exampleStackXsd);
    Stack stack = manager.getStack();
    assertEquals("Testing top of stack", "baz", stack.top());
    assertEquals("Testing stack size", 3, stack.toArray().length);
  }
}
